<script lang="ts" setup>
import type { DataFormOptionsProps } from '#/components/data-form/types';

import { ref } from 'vue';

import { DataForm } from '#/components/data-form';

import { useForm } from './data';

defineProps<{
    enums: Record<string, any>;
}>();

const dataFormRef = ref<InstanceType<typeof DataForm>>();

const { fields, rules } = useForm();

const open = (options: DataFormOptionsProps) => {
    // 打开弹窗
    dataFormRef.value?.open(options);
};

defineExpose({ open });
</script>

<template>
    <DataForm ref="dataFormRef" :fields="fields" :enums="enums" :rules="rules" api="/system/config" title="参数配置" />
</template>
